package it.mp.multitask.factory;

import android.preference.CheckBoxPreference;
import android.preference.ListPreference;
import android.preference.PreferenceGroup;
import it.mp.multitask.R;
import it.mp.multitask.Setup;
import it.mp.multitask.preference.BackgroundListPreference;
import it.mp.multitask.preference.NumberBoxPreference;

public class PreferenceDialog implements Preference {

	private Setup setup;

	public PreferenceDialog(Setup setup){
		this.setup=setup;
	}
	
	public void crea() {
		CheckBoxPreference cbRunning = (CheckBoxPreference) setup.findPreference("pref_running");
		NumberBoxPreference nbRunningNumber = (NumberBoxPreference) setup.findPreference(setup.getResources().getString(R.string.App_running_number));
		BackgroundListPreference blRunningTheme=(BackgroundListPreference) setup.findPreference(setup.getResources().getString(R.string.pref_background_theme));
		
		CheckBoxPreference cbRecently = (CheckBoxPreference) setup.findPreference("pref_recently");
		NumberBoxPreference nbRecentlyNumber = (NumberBoxPreference) setup.findPreference(setup.getResources().getString(R.string.App_recently_number));
		BackgroundListPreference blRecentlyTheme=(BackgroundListPreference) setup.findPreference(setup.getResources().getString(R.string.pref_background_theme_rc));
		
		CheckBoxPreference cbService = (CheckBoxPreference) setup.findPreference("pref_service");
		NumberBoxPreference nbServiceNumber = (NumberBoxPreference) setup.findPreference(setup.getResources().getString(R.string.App_service_number));
		BackgroundListPreference blServiceTheme=(BackgroundListPreference) setup.findPreference(setup.getResources().getString(R.string.pref_background_theme_srv));
		
		PreferenceGroup pgPreferred=(PreferenceGroup) setup.findPreference(setup.getResources().getString(R.string.App_preferred));
		BackgroundListPreference blPreferredTheme=(BackgroundListPreference) setup.findPreference(setup.getResources().getString(R.string.pref_background_theme_pa));
		
		PreferenceGroup pgBlackList=(PreferenceGroup) setup.findPreference(setup.getResources().getString(R.string.App_not_show));
				
		CheckBoxPreference cbSectionOrder = (CheckBoxPreference) setup.findPreference(setup.getResources().getString(R.string.app_alphabetic_order));
		NumberBoxPreference nbMargin = (NumberBoxPreference) setup.findPreference(setup.getResources().getString(R.string.theme_margin));
		
		ListPreference lpMode = (ListPreference) setup.findPreference(setup.getResources().getString(R.string.theme_mode));
		CheckBoxPreference cbDoubleClick = (CheckBoxPreference) setup.findPreference(setup.getResources().getString(R.string.app_double_click));
		CheckBoxPreference cbShowTitle = (CheckBoxPreference) setup.findPreference(setup.getResources().getString(R.string.show_title));
		CheckBoxPreference cbShowMemory = (CheckBoxPreference) setup.findPreference(setup.getResources().getString(R.string.app_show_available_memory));
		
		CheckBoxPreference cbShowDeleted = (CheckBoxPreference) setup.findPreference(setup.getResources().getString(R.string.app_show_app_deleted_by_system));
		CheckBoxPreference cbShowRecycledBin = (CheckBoxPreference) setup.findPreference(setup.getResources().getString(R.string.app_recycle_bin));
		
		CheckBoxPreference cbShowTitleApps = (CheckBoxPreference) setup.findPreference(setup.getResources().getString(R.string.app_show_title));
		ListPreference lpIconDimension = (ListPreference) setup.findPreference(setup.getResources().getString(R.string.app_title_size));
		
		ListPreference blGlobal=(ListPreference) setup.findPreference(setup.getResources().getString(R.string.pref_background));
		CheckBoxPreference cbAudio = (CheckBoxPreference) setup.findPreference(setup.getResources().getString(R.string.audio_controls));
		blGlobal.setEnabled(false);
		
		cbRunning.setEnabled(true);
		nbRunningNumber.setEnabled(true);
		blRunningTheme.setEnabled(true);
		
		
		cbRecently.setEnabled(true);
		nbRecentlyNumber.setEnabled(true);
		blRecentlyTheme.setEnabled(true);
		
		cbService.setEnabled(true);
		nbServiceNumber.setEnabled(true);
		blServiceTheme.setEnabled(true);
		
		pgPreferred.setEnabled(true);
		blPreferredTheme.setEnabled(true);
		
		pgBlackList.setEnabled(true);
				
		
		cbSectionOrder.setEnabled(true);
		nbMargin.setEnabled(true);
		
		lpMode.setEnabled(true);
		cbDoubleClick.setEnabled(false);
		cbShowTitle.setEnabled(false);
		cbShowMemory.setEnabled(false);
		
		cbShowDeleted.setEnabled(true);
		cbShowRecycledBin.setEnabled(true);
		
		cbShowTitleApps.setEnabled(false);
		lpIconDimension.setEnabled(false);
		cbAudio.setEnabled(false);
						
	}

}
